﻿@{
    Layout = "~/Views/Shared/Main.cshtml";
}
<div class="box">
    <div class="title">
        <h3>
            请激活您的账户</h3>
    </div>
    <div class="box-content">
        <div class="container-fluid">
            <h3 class="text-error">
                请先激活您的账号</h3>
            <span>如果您没有收到我们发出的验证邮件，可以<a href="javascript:;" onclick="resendactivation()"
                    class="btn btn-primary btn-mini">重发激活邮件</a>，如果您任然无法收取到邮件或始终无法激活您的账号，请与管理员联系！</span>
            <div style="display: none;" id="form">
                <div class="control-group">
                    <label class="control-label">
                        请输入用户名：</label>
                    <div class="controls">
                        <input type="text" class="span4" id="txtUsername" placeholder="输入您注册时使用的用户名" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">
                    </label>
                    <div class="controls">
                        <input type="button" class="btn btn-primary" onclick="doresend()" value="重新发送" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@section tail{
    <script type="text/javascript">
        function resendactivation() {
            $('#form').show();
        }
        function doresend() {
            if ($('#txtUsername').val() == '') {
                $('#txtUsername').parent().parent().addClass('error');
                $('#txtUsername').parent().append($('<span>输入有误</span>'));
                return;
            }
            $.ajax({
                url: '/account/resend',
                method: 'get',
                data: { u: $('#txtUsername').val(), t: 0 },
                success: function (result) {
                    if (result == '1') {
                        window.location.href = '/account/operationdone?t=4';
                    }
                    else {
                        alert('用户不存在，请查证');
                    }
                }
            });
        }
    </script>
}
